package sistemaobra.material;

import java.util.List;

import org.hibernate.Session;

public class MaterialDAOHibernate implements MaterialDAO {
	
	private Session session;

	public Session getSession() {
		return session;
	}

	public void setSession(Session session) {
		this.session = session;
	}

	@Override
	public Material carregarMaterial(int idMaterial) {
		return (Material) this.session.get(Material.class, idMaterial);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Material> carregarListMaterial() {
		return this.session.createCriteria(Material.class).list();

	}
	
	
}
